package com.example.fragmentdemo;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;


public class ThridFragment extends Fragment {



    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle=getArguments();
        if (bundle!= null) {
            String data=bundle.getString("activity_data");
            Toast.makeText(requireActivity(),data,Toast.LENGTH_LONG).show();
        }
    }


    private void getData() {
        String data = ((MainActivity) requireActivity()).sendData();
    }

    public String sendMsg(){
        return "来在Activity";
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_thrid, container, false);
    }
}